<!DOCTYPE html>
<title>Test "defaultMuted" IDL, "muted" IDL and content attributes.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
test(function() {
    var video = document.createElement("video");
    // Test that "defaultMuted" IDL attribute reflects "muted" content attribute and
    // that "muted" IDL attribute is not affected by content attribute.
    assert_false(video.muted);
    assert_false(video.defaultMuted);
    video.setAttribute("muted", "muted");
    assert_false(video.muted);
    assert_true(video.defaultMuted);
    video.removeAttribute("muted", "muted");
    assert_false(video.muted);
    assert_false(video.defaultMuted);

    // Test that "muted" IDL attribute is not affected by "defaultMuted" IDL attribute.
    video.defaultMuted = true;
    assert_false(video.muted);
}, "Test 'defaultMuted' and 'muted' IDL attributes");

async_test(function(t) {
    var video = document.createElement("video");
    // Set "muted" content attribute and test that it doesn't affect "muted" IDL attribute.
    video.setAttribute("muted", "muted");

    video.onloadedmetadata = t.step_func_done(function() {
        // "muted" IDL attribute shouldn't be affected by muted content attribute.
        assert_false(video.muted);
    });

    video.src = "content/test.oga";
}, "Test 'muted' content and IDL attributes on video load");
</script>